package com.zr.daoimpl;

import java.util.Iterator;
import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.DeliverypointDaoLPN;
import com.zr.model.Deliverypoint;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Repository("DeliverypointDaoLPN")
public class DeliverypointDaoImplLPN  extends BaseDaOImpl implements DeliverypointDaoLPN{

	@Override
	public JSONArray findDP() {
		JSONArray j = new JSONArray();
		String hql = " from Deliverypoint dp";
		Query query = this.getCurrentSession().createQuery(hql);
		List<Deliverypoint>  obj = query.list();	
		Iterator<Deliverypoint> it = obj.iterator();
		while(it.hasNext()) {
			JSONObject js=new JSONObject();
			Deliverypoint dp=it.next();
			js.put("dpId",dp.getDpId());
			js.put("dpName", dp.getDpName());
			js.put("dpGrade", dp.getDpGrade());
			j.add(js);					  
		}		
		return j;
	}

}
